package com.wind;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

/*********************************************************
 * 版权信息：2018/4/20北京振中电子技术有限公司版权所有
 * 创建作者：zengfanrui
 * 创建日期：2018/4/20
 * *******************************************************
 * 更新历史：    作者      日期      更新摘要
 * <p>
 * *******************************************************
 * 类功能说明：
 */

public class BuyBookAdapter extends BaseAdapter {

    private Context mContext;
    private List<BuyBookBean> mData;

    public BuyBookAdapter(Context mContext, List<BuyBookBean> mData){
        this.mContext = mContext;
        this.mData = mData;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int position) {
        return mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null){
            holder = new ViewHolder();
            convertView = LayoutInflater.from(mContext).inflate(R.layout.buy_book_item, null);
            holder.textView = convertView.findViewById(R.id.text);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        holder.textView.setText(mData.get(position).getmUser());
        return convertView;
    }

    class ViewHolder{
        TextView textView;
    }

}
